<template>
	<gui-page :customHeader="false">
		<template v-slot:gBody>
			<view class="gui-padding">
				<my-dynamic-form :formConfig="dataRec.formConfig" v-model:formData="dataRec.formData" @submit="releaseBtn"></my-dynamic-form>
			</view>
		</template>
	</gui-page>
</template>
<script setup>
import { Local } from '@utils/storage.js';
import imgArr from '@assets/js/export.js';
import graceJS from '@/Grace6/js/grace.js';
// import {  } from '@api/api.js';
import formConfig from '@assets/js/testFormConfig.js';
import { reactive, ref, toRefs, onMounted, onActivated } from 'vue';
import { onShow } from '@dcloudio/uni-app';

let imgArrReactive = reactive(imgArr);
let dataRec = reactive({
	formConfig,
	formData: {
		title: '', //标题
		type: '', // 局种
		city: '', //市区
		time: '', // 时间
		images: [], // 图片
		tag: [], // 标签
		gender: 0, // 性别
		mark:'',// 备注
	}
});
let releaseBtn = () => {
	console.log('提交',dataRec.formData);
};
onShow(() => {
	let testList = ['大专以下', '大专', '本科', '留学生', '硕士', '博士'];
	let tagsList = [
		{
			id: 1,
			text: '标签01',
			checked: false
		},
		{
			id: 2,
			text: '标签02',
			checked: false
		},
		{
			id: 3,
			text: '标签03',
			checked: false
		}
	];
	let genderList = [
		{
			id: 1,
			name: '男',
			value: 1,
			color: '#008AFF'
		},
		{
			id: 2,
			name: '女',
			value: 0,
			color: '#008AFF'
		}
	];
	// 设置动态表单里的数组
	dataRec.formConfig.configForm.forEach((item) => {
		if (item.pickerListKey == 'typeList') {
			item.pickerList = testList;
		} else if (item.pickerListKey == 'genderList') {
			item.pickerList = genderList;
		} else if (item.pickerListKey == 'tagList') {
			item.pickerList = tagsList;
		}
	});
});
</script>
<style lang="scss" scoped></style>
